package com.hellobike.haxing.modules.wms.mapper;

import java.util.List;

import com.hellobike.haxing.modules.wms.dto.ExportPutawayDto;
import org.apache.ibatis.annotations.Param;
import com.hellobike.haxing.modules.wms.entity.DocPutaway;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;

/**
 * @Description: t_wms_doc_putaway
 * @Author: haxing-boot
 * @Date:   2020-01-09
 * @Version: V1.0
 */
public interface DocPutawayMapper extends BaseMapper<DocPutaway> {

    @Select("SELECT sp.spu_name,sk.sku_code,sk.barcode,d.qty,p.partition_code,l.loc_code,null as act_qty,null as act_loc_code,null as sku_production_date  " +
            "FROM t_wms_stock_task as d  " +
            "LEFT JOIN t_sku as sk ON sk.id=d.sku_id  " +
            "LEFT JOIN t_spu as sp ON sp.id=sk.spu_id  " +
            "LEFT JOIN t_wms_location as l ON l.id=d.plan_loc_id  " +
            "LEFT JOIN t_wms_partition as p ON p.id=l.partition_id  " +
            "WHERE d.deleted=0 AND d.task_type='PA' AND d.doc_oper_id=#{putawayId}")
    List<ExportPutawayDto> exportPutaway(@Param("putawayId") Long putawayId);
}
